/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import core.Student;
import db.dao.StudentDAO;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;

/**
 *
 *
 *
 * @author jonas
 */
public class StudentDataTableBean{
    private ArrayList<Student> students;
    private ArrayList<Student> dataTst;
    private String dataVar;
    private int headerCnt;
    //private String currHeader;

    public static int COLUMN_COUNT = 5;
    private String[] headers = new String[COLUMN_COUNT];

    public String getCurrHeader(){
        String header = headers[headerCnt];
        headerCnt++;
        headerCnt %= COLUMN_COUNT;
        return header;
    }

    @PostConstruct
    public void init(){
        headers[0] = "id";
        headers[1] = "First name";
        headers[2] = "Last Name";
        headers[3] = "Address";
        headers[4] = "Email";

        students = new ArrayList();
        dataTst = new ArrayList();
        dataVar = "dataVar";
    }

    public String getDataVar(){
        return dataVar;
    }
    public void setDataVar(String str){
        dataVar = str;
    }

    public List<Student> getDataTst(){
        dataTst.clear();

        dataTst = (ArrayList)StudentDAO.readAll();
        
        return dataTst;
    }

    public List<Student> getStudents(){

        return null;
    }
    public void setStudents(ArrayList<Student> students){
        this.students = students;
    }
}
